package com.csx.saas.platform.init.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.csx.basic.base.entity.Entity;
import com.csx.saas.platform.init.enumeration.InitServiceOrderTimeDiscountStateEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

import java.math.BigDecimal;
import java.time.LocalDateTime;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 服务购买时长折扣
 * </p>
 *
 * @author ChenSongXin
 * @since 2021-02-28
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("saas_init_service_order_time_discount")
@ApiModel(value = "InitServiceOrderTimeDiscount", description = "服务购买时长折扣")
@AllArgsConstructor
public class InitServiceOrderTimeDiscount extends Entity<Long> {

    private static final long serialVersionUID = 1L;

    /**
     * 名称
     */
    @ApiModelProperty(value = "名称")
    @Length(max = 20, message = "名称长度不能超过20")
    @TableField(value = "order_time_name", condition = LIKE)
    @Excel(name = "名称")
    private String orderTimeName;

    /**
     * 折扣
     */
    @ApiModelProperty(value = "折扣")
    @TableField("order_time_discount")
    @Excel(name = "折扣")
    private BigDecimal orderTimeDiscount;

    /**
     * 天数
     */
    @ApiModelProperty(value = "天数")
    @TableField("day")
    @Excel(name = "天数")
    private Integer day;

    /**
     * 状态\n#{ENABLE:启用;DISABLE:禁用;}
     */
    @ApiModelProperty(value = "状态\n#{ENABLE:启用;DISABLE:禁用;}")
    @TableField("state")
    @Excel(name = "状态\n#{ENABLE:启用;DISABLE:禁用;}", replace = {"启用_ENABLE", "禁用_DISABLE",  "_null"})
    private InitServiceOrderTimeDiscountStateEnum state;

    /**
     * 排序
     */
    @ApiModelProperty(value = "排序")
    @TableField("sort_value")
    @Excel(name = "排序")
    private Integer sortValue;


    @Builder
    public InitServiceOrderTimeDiscount(Long id, LocalDateTime createTime, Long createdBy, LocalDateTime updateTime, Long updatedBy, 
                    String orderTimeName, BigDecimal orderTimeDiscount, Integer day, InitServiceOrderTimeDiscountStateEnum state, Integer sortValue) {
        this.id = id;
        this.createTime = createTime;
        this.createdBy = createdBy;
        this.updateTime = updateTime;
        this.updatedBy = updatedBy;
        this.orderTimeName = orderTimeName;
        this.orderTimeDiscount = orderTimeDiscount;
        this.day = day;
        this.state = state;
        this.sortValue = sortValue;
    }

}
